home *** CD-ROM | disk | FTP | other *** search
- Path: templar.fgi.net!bwendlin
- From: bwendlin@I_should_put_my_domain_in_etc_NNTP_INEWS_DOMAIN (Physics Lizard)
- Newsgroups: comp.lang.c
- Subject: Re: Handling complex numbers...
- Date: 14 Mar 1996 05:58:23 GMT
- Organization: FGInet, Inc., Springfield, IL
- Message-ID: <4i8chv$12a@grail.fgi.net>
- References: <4hi113$2i8k@mercury.cc.uottawa.ca> <larry_kearney-0803960747220001@amaryllisp1.appsig.com> <1996Mar11.204246.7444@nosc.mil>
- NNTP-Posting-Host: templar.fgi.net
- X-Newsreader: TIN [version 1.2 PL2]
-
- John W. Herman inexplicably wrote:
- } larry_kearney@appsig.com (Larry Kearney) writes:
-
- } >> Dear fellow netters,
- } >>
- } >> Can someone kindly explain to me how to represent complex numbers in C?
- } >> I am writing a numerical method program to calculate the area under
- } >> a curve using Simpson's Rule. The problem that I face right now is
- } >> the representation of "i" (where i^2 = -1) in my C program.
- } >>
- } >> Here's a simple example of what I mean:
- } >>
- } >> _b
- } >> |
- } >> | exp(ix) dx
- } >> _|
- } >> a
- } >>
- } >>
- } >> How do I implement this function exp(ix)?
- } >>
- } >> I'm grateful for your help.
- } >>
- } >> Charles Tran
- } >> --
- } >> Charles
-
- You may be able to use the fact that exp(ix) = (cos(x) - i * sin(x))
- or something like that. The formula might be similar. THen
- you can use a structure to represent the real and imaginary parts of
- the function. Like: cos is the real, sin is the imaginary.
-
- --
- Bill Wendling bwendlin@fgi.net
- GCS/M/S d s-:+ a? C++++$ UL++>++++ P+++>+++++ L+++>+++++ E--- W-- N++ !o
- !K w--- O M-- !V PS+++@ PE- Y !PGP t+++(*) 5-- X- R++ tv--- b+++ DI++++
- !D G+ e++>+++++ h(++) !r !y+
-